﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Resto.CostControl.Core.Domain.Model;
using Resto.CostControl.Core.Cache;
using Resto.CostControl.Core.Facade.MaterialModule.DataTransferObject;

namespace Resto.CostControl.Core.Facade.SupplierModule.DataTransferObject
{
    /// <summary>
    /// 供应商合同项DTO
    /// </summary>
    [Serializable]
    public class SupplierContractItemDTO
    {
        #region 构造函数

        public SupplierContractItemDTO() { }

        internal SupplierContractItemDTO(SupplierContractItem item)
        {
            this.Price = item.Price;
            this.MaterialId = item.MaterialID;

            this.Material = MaterialDTOCache.Get(item.MaterialID);
            
        }

        #endregion

        #region 基本属性

        /// <summary>
        /// 价格
        /// </summary>
        public decimal Price { get; set; }

        /// <summary>
        /// 品名Id
        /// </summary>
        public string MaterialId { get; set; }

        public MaterialDTO Material { get; protected set; }


        #endregion

        #region 方法

        internal SupplierContractItem ToSupplierContractItem()
        {
            return new SupplierContractItem()
            {
                Price = this.Price,
                MaterialID = this.MaterialId,
            };            
        }

        

        #endregion
    }
}
